package jpb.Interceptor.configuration;

import jpb.Interceptor.FounderInterceptor;
import jpb.module.service.manager.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by haol on 2017/4/1.
 */
@Configuration
public class FounderInterceptorConfiguration extends WebMvcConfigurerAdapter {

        @Autowired
        private ManagerService managerService;

        public void addInterceptors(InterceptorRegistry registry) {
                InterceptorRegistration interceptorRegistry = registry.addInterceptor(
                        new FounderInterceptor(managerService));
                interceptorRegistry.addPathPatterns("/api/web/manager/i/**/org");
                interceptorRegistry.addPathPatterns("/api/web/organize/i/**/del");
        }
}
